package de.tum.in.elitese.wahlsys.persister.persistence_objects;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import de.tum.in.elitese.wahlsys.persister.PersistenceObject;

/**
 * see Table LANDESLISTE
 * 
 * @author Christoph Frenzel
 * 
 */
public class Landesliste extends PersistenceObject {
	private static final List<String> FIELD_NAMES = Collections
			.unmodifiableList(Arrays.asList(new String[] { "ID", "STIMMEN",
					"RANG", "PARTEI", "BUNDESLAND" }));

	private static final String TABLE_NAME = "LANDESLISTE";

	private Bundesland fBundesland;

	private Integer fId;

	private Partei fPartei;

	private Integer fStimmen = 0;

	private Short Rang;

	public Bundesland getBundesland() {
		return fBundesland;
	}

	public Integer getId() {
		return fId;
	}

	public Partei getPartei() {
		return fPartei;
	}

	@Override
	public List<String> getPersistanceStrings() {
		List<Object> values = new ArrayList<Object>(3);
		values.add(getId());
		values.add(getStimmen());
		values.add(getRang());
		values.add(getPartei().getName());
		values.add(getBundesland().getName());

		List<String> result = new ArrayList<String>(1);
		result.add(createInsertString(TABLE_NAME, FIELD_NAMES, Collections
				.unmodifiableList(values)));
		return result;
	}

	public Short getRang() {
		return Rang;
	}

	public Integer getStimmen() {
		return fStimmen;
	}

	public void setBundesland(Bundesland bundesland) {
		fBundesland = bundesland;
	}

	public void setId(Integer id) {
		fId = id;
	}

	public void setPartei(Partei partei) {
		fPartei = partei;
	}

	public void setRang(Short rang) {
		Rang = rang;
	}

	public void setStimmen(Integer stimmen) {
		fStimmen = stimmen;
	}
}
